package com.getguang.superstore.home.list

import com.getguang.superstore.databinding.CellDealsEmptyBinding
import com.getguang.superstore.databinding.CellDealsItemBinding
import com.getguang.superstore.databinding.CellDealsLoadingBinding
import com.getguang.superstore.databinding.CellDealsTitleBinding
import com.getguang.superstore.databinding.CellDealsBottomLineBinding
import com.starblink.android.basic.adapter.BaseBindingVH
import com.starblink.android.basic.ext.visibleOrGone


class DealsTitleCell(binding: CellDealsTitleBinding) :
    BaseBindingVH<DealsTitleModel, CellDealsTitleBinding>(binding) {
    override fun onBind(model: DealsTitleModel, position: Int) {
        binding.tvCount.visibleOrGone(model.count != null)
        binding.tvDes.visibleOrGone(model.count != null)
        binding.tvCount.text = if (model.count != null) {
            model.count.toString()
        } else {
            "*"
        }
        if (model.count != null) {
            binding.container.removeView(binding.vLoading)
        }
    }

}

class DealsEmptyCell(binding: CellDealsEmptyBinding) :
    BaseBindingVH<DealsEmptyModel, CellDealsEmptyBinding>(binding) {
    override fun onBind(model: DealsEmptyModel, position: Int) {

    }

}

class DealsLoadingCell(binding: CellDealsLoadingBinding) :
    BaseBindingVH<DealsLoadingModel, CellDealsLoadingBinding>(binding) {
    override fun onBind(model: DealsLoadingModel, position: Int) {
        binding.vShm1.isAutoStart = true
        binding.vShm2.isAutoStart = true
        binding.vShm3.isAutoStart = true
    }

}

class DealsBottomLineCell(binding: CellDealsBottomLineBinding) :
    BaseBindingVH<DealsBottomLineModel, CellDealsBottomLineBinding>(binding) {
    override fun onBind(model: DealsBottomLineModel, position: Int) {

    }

}